package com.ailesson.common.util;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import org.springframework.util.StringUtils;

public class IdGenUtils {

    private static Snowflake snowflake = IdUtil.getSnowflake(1, 1);

    public static long snowflakeId() {
        return snowflake.nextId();
    }

    public static String snowflakeStrId(String prefix) {
        if (!StringUtils.hasText(prefix)){
            prefix = "";
        }
        return prefix+snowflake.nextId();
    }
}
